package com.iraeta.controller;


import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.iraeta.entity.main.HikDeleteLog;
import com.iraeta.service.hik.IHikDeleteLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 海康删除的日志Controller
 * 
 * @author 陈宾
 * @date 2023-10-07
 */
@RestController
@RequestMapping("/iraeta/hikdeletelog")
public class HikDeleteLogController extends BaseController
{
    @Autowired
    private IHikDeleteLogService hikDeleteLogService;

    /**
     * 查询海康删除的日志列表
     */
    @RequestMapping("/list")
    public String list(@RequestBody JSONObject jo)
    {
        HikDeleteLog hikDeleteLog = new HikDeleteLog();
        hikDeleteLog.setName(jo.getString("name"));
        this.pageSet(jo);
        List<HikDeleteLog> list = hikDeleteLogService.selectHikDeleteLogList(hikDeleteLog);
        PageInfo<HikDeleteLog> HikDeleteLogPageInfo = this.getPageInfo(list);
        return this.success(HikDeleteLogPageInfo);
    }

    /**
     * 获取海康删除的日志详细信息
     */
    @GetMapping(value = "/{id}")
    public String getInfo(@PathVariable("id") Long id)
    {
        return success(hikDeleteLogService.selectHikDeleteLogById(id));
    }

    /**
     * 新增海康删除的日志
     */
    @PostMapping
    public String add(@RequestBody HikDeleteLog hikDeleteLog)
    {
        hikDeleteLogService.insertHikDeleteLog(hikDeleteLog);
        return success();
    }

    /**
     * 修改海康删除的日志
     */
    @PutMapping
    public String edit(@RequestBody HikDeleteLog hikDeleteLog)
    {
        hikDeleteLogService.updateHikDeleteLog(hikDeleteLog);
        return success();
    }

    /**
     * 删除海康删除的日志
     */
	@DeleteMapping("/{ids}")
    public String remove(@PathVariable Long[] ids)
    {
        hikDeleteLogService.deleteHikDeleteLogByIds(ids);
        return success();
    }
}
